<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>甲方工程评价</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    {CSS href="__ADDONSTATIC__css/font.css" /}
    {CSS href="__ADDONSTATIC__css/xadmin.css" /}
    {js href='__ADDONSTATIC__js/jquery-3.2.1.min.js' /}
    {CSS href="__ADDONSTATIC__css/css.css" /}

    {js href='__ADDONSTATIC__js/xadmin.js' /}
    {js href='__ADDONSTATIC__js/util.js' /}
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    {js href='__ADDONSTATIC__lib/layui/layui.js' /}
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body style="background: #f0eeee;">
<div class="center">
    <div class="answer_bg">
        <div class="answer_sour">
            <?php echo $evaluateTemplate ?>
        </div>
    </div>
    <div class="answer_bg">
        <div class="evaluate_option">
            <div style="margin: 10px auto 15px auto;width: 90%">请及时进行评价，24小时内若未评价，视为满意</div>
            {foreach  name="evaluateOptions" item="evaluateOption"}
            <div class="project_k">
                <div class="project_stit">
                    <span>{$evaluateOption}</span>
                </div>
                <div class="project_sele">
                    <select name="{$evaluateOption}">
                        <option value="满意">满意</option>
                        <option value="不满意">不满意</option>
                    </select>
                </div>
            </div>
            {/foreach}
        </div>
        <div class="project_k">
            <div class="project_stit">
                <span>总体满意评价</span>
            </div>
            <div class="project_sele">
                <select name="status">
                    <option value="1">满意</option>
                    <option value="0">不满意</option>
                </select>
            </div>
        </div>
        <div class="project_k">
            <div class="project_stit">
                <span/>备注：</span>
            </div>
            <div class="project_sele">
                <textarea name="remark" placeholder="请输入内容" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="reg_btn2">
            <button onclick="sendMessage({$evaluate.id})" class="layui-btn layui-btn-lg layui-btn-normal">提交评价</button>
        </div>
    </div>
</div>

</div>
</div>

<script>
    //选项卡
    layui.use('element', function () {
        var element = layui.element;
    });

    /**
     * 保存评价信息
     * @param projectId
     * @param statusId
     */
    function sendMessage(eid) {
        var data = {};
        data.remark = $("textarea").val();
        data.id=eid;
        data.status = $("select[name='status']").val();
        var evaluateInfo = [];
        $(".evaluate_option select").each(function(){
            var item = {};
            item.key =  $(this).attr("name");
            item.value = $(this).val();
            evaluateInfo.push(item);
        })
        data.evaluateInfo = JSON.stringify(evaluateInfo);
        ajaxUrl("{:addonUrl('Wap/evaluateProject')}",
            data, function (data) {
            layer.alert(data.message, {}, function (index) {
                layer.close(index);
                if(data.code && data.code == '1'){
                    // 微信页面关闭
                    WeixinJSBridge.invoke('closeWindow', {}, function (res) {});
                }
            });
            });
    }
</script>
</body>

</html>